<template>
  <div>
    <el-card class="box-card">
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="userName">
          <el-input v-model="form.userName"></el-input>
        </el-form-item>
        <el-form-item label="password">
          <el-input type="password" v-model="form.password"></el-input>
        </el-form-item>
      </el-form>
      <el-button @click="login">login</el-button>
    </el-card>
  </div>
</template>

<script>


export default {
  name: 'HomeView',
  data(){
    return{
      form:{
        userName:'',
        password:''
      }
    }
  },
  methods:{
        login(){
          let fd=new FormData()
          fd.append("userName",this.form.userName)
          fd.append("password",this.form.password)
          this.$axios.post("/api/boot/login",fd).then(
              r=>{
                sessionStorage.setItem("user",r.data)
                this.$router.push("about")
              }
          )
        }
  }
}
</script>
<style>
.box-card{
  margin-left: 30%;
  margin-right: 30%;
  margin-top: 10%;
}
</style>
